From d8d59e40a2894ce0eb7903ad4fb4ebcd3ef78676 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 11 Dec 2014 15:16:43 -0800 Subject: [PATCH] Sleep before unlinking to fix a flaky test on windows --- tests/test_cargo_compile.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index 225c8c5bd..b87f08036 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -1509,6 +1509,12 @@ test!(compile_then_delete { assert_that(p.cargo_process("run"), execs().with_status(0)); assert_that(&p.bin("foo"), existing_file()); + if cfg!(windows) { + // HACKHACK: On windows unlinking immediately after running often fails, so sleep + use std::io::timer::sleep; + use std::time::duration::Duration; + sleep(Duration::milliseconds(100)); + } fs::unlink(&p.bin("foo")).unwrap(); assert_that(p.process(cargo_dir().join("cargo")).arg("run"), execs().with_status(0)); -- 2.30.2